package org.projectback.service.SarchService.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.projectback.entity.FileEntity.DTO.FileDTO;
import org.projectback.service.SarchService.SearchService;
import org.projectback.service.SqlService.FileSqlService;
import org.springframework.stereotype.Service;

import java.io.File;
import java.util.List;

/**
 * @author K·K
 * @version 1.0
 * @Date 2025/10/9
 */
@Service
public class SearchServiceImpl implements SearchService {
    @Resource
    private FileSqlService fileSqlService;

    //根据对应参数类型寻找
    @Override
    public <T> FileDTO getFileDTO(long userid, T data) {

        if (data instanceof String) {
            QueryWrapper<FileDTO> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("user_id", userid);
            List<FileDTO> fileList = fileSqlService.list(queryWrapper);
            return fileList.isEmpty() ? null : fileList.getFirst();
        }

        return null;
    }

    @Override
    public File getFile(FileDTO fileDTO) {
        return null;
    }

}
